libimobiledevice-1.3.0^20240916gited9703d-1.fc42

List of Findings

Error: CPPCHECK_WARNING (CWE-758): [#def1]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/ed25519/sha512.c:108: error[shiftTooManyBits]: Shifting 64-bit value by 64 bits is undefined behaviour
#  106|       /* fill W[16..79] */
#  107|       for (i = 16; i < 80; i++) {
#  108|->         W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
#  109|       }        
#  110|   

Error: GCC_ANALYZER_WARNING (CWE-127): [#def2]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_conv.c: scope_hint: In function 't_fromb64'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_conv.c:142:13: warning[-Wanalyzer-out-of-bounds]: heap-based buffer under-read
#  140|     j = size;
#  141|     while(1) {
#  142|->     a[j] = a[i];
#  143|       if(--i < 0)
#  144|         break;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def3]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c: scope_hint: In function 't_fshash'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:147:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'creat(&dotpath, 384)'
#  145|   
#  146|     sprintf(dotpath, "/tmp/rnd.%d", getpid());
#  147|->   if(creat(dotpath, 0600) >= 0 && stat(dotpath, &st) >= 0)
#  148|       SHA1Update(&ctxt, (unsigned char *) &st, sizeof(st));
#  149|     unlink(dotpath);

Error: COMPILER_WARNING (CWE-563): [#def4]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c: scope_hint: In function 't_initrand'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:194:12: warning[-Wunused-variable]: unused variable 'ctxt'
#  194 |   SHA1_CTX ctxt;
#      |            ^~~~
#  192|   t_initrand()
#  193|   {
#  194|->   SHA1_CTX ctxt;
#  195|   #ifdef USE_FTIME
#  196|     struct timeb t;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def5]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c: scope_hint: In function 't_initrand.part.0'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:233:5: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open("/dev/urandom", 0)'
#  231|   #if !defined(WINDOWS) && !defined(WIN32)
#  232|     i = open("/dev/urandom", O_RDONLY);
#  233|->   if(i > 0) {
#  234|       r += read(i, preseed.devrand, sizeof(preseed.devrand));
#  235|       close(i);

Error: GCC_ANALYZER_WARNING: [#def6]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/3rd_party/libsrp6a-sha512/t_misc.c:234:10: warning[-Wanalyzer-fd-use-without-check]: 'read' on possibly invalid file descriptor 'open("/dev/urandom", 0)'
#  232|     i = open("/dev/urandom", O_RDONLY);
#  233|     if(i > 0) {
#  234|->     r += read(i, preseed.devrand, sizeof(preseed.devrand));
#  235|       close(i);
#  236|     }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def7]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/common/userpref.c: scope_hint: In function 'pair_record_get_item_as_key_data'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/common/userpref.c:1143:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '*value.data' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
# 1141|   		plist_get_data_val(node, &buffer, &length);
# 1142|   		value->data = (unsigned char*)malloc(length+1);
# 1143|-> 		memcpy(value->data, buffer, length);
# 1144|   		value->data[length] = '\0';
# 1145|   		value->size = length+1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c: scope_hint: In function 'afc_client_new_with_service_client'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:77:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   75|   
#   76|   	afc_client_t client_loc = (afc_client_t) malloc(sizeof(struct afc_client_private));
#   77|-> 	client_loc->parent = service_client;
#   78|   	client_loc->free_parent = 0;
#   79|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c: scope_hint: In function 'make_strings_list.part.0'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:394:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'list'
#  392|   	list = (char **) malloc(sizeof(char *) * (nulls + 1));
#  393|   	for (i = 0; i < nulls; i++) {
#  394|-> 		list[i] = strdup(tokens + j);
#  395|   		j += strlen(list[i]) + 1;
#  396|   	}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:395:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'strdup(tokens + (sizetype)j)' where non-null expected
<built-in>: note: argument 1 of '__builtin_strlen' must be non-null
#  393|   	for (i = 0; i < nulls; i++) {
#  394|   		list[i] = strdup(tokens + j);
#  395|-> 		j += strlen(list[i]) + 1;
#  396|   	}
#  397|   	list[i] = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/afc.c:397:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'list'
#  395|   		j += strlen(list[i]) + 1;
#  396|   	}
#  397|-> 	list[i] = NULL;
#  398|   
#  399|   	return list;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def12]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c: scope_hint: In function 'bt_packet_logger_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/bt_packet_logger.c:89:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   87|   
#   88|   	bt_packet_logger_client_t client_loc = (bt_packet_logger_client_t) malloc(sizeof(struct bt_packet_logger_client_private));
#   89|-> 	client_loc->parent = parent;
#   90|   	client_loc->worker = THREAD_T_NULL;
#   91|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def13]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c: scope_hint: In function 'companion_proxy_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/companion_proxy.c:84:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   82|   
#   83|   	companion_proxy_client_t client_loc = (companion_proxy_client_t) malloc(sizeof(struct companion_proxy_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   	client_loc->event_thread = THREAD_T_NULL;
#   86|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def14]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_command_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:181:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'tmp'
#  179|   
#  180|   	/* copy name */
#  181|-> 	tmp->name = strdup(name);
#  182|   
#  183|   	/* copy arguments */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:189:38: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)(argc + 2) * 8)'
#  187|   		tmp->argv = malloc(sizeof(char*) * (argc + 2));
#  188|   		for (i = 0; i < argc; i++) {
#  189|-> 			tmp->argv[i] = strdup(argv[i]);
#  190|   		}
#  191|   		tmp->argv[i+1] = NULL;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def16]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_encode_string'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:286:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'encoded' where non-null expected
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
#  284|   
#  285|   	*encoded_buffer = malloc(sizeof(char) * (*encoded_length));
#  286|-> 	memset(*encoded_buffer, '\0', *encoded_length);
#  287|   	for (position = 0, index = 0; index < length; index++) {
#  288|   		position = (index * (2 * sizeof(char)));

Error: GCC_ANALYZER_WARNING (CWE-476): [#def17]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_client_receive_response'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:419:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'buffer'
#  417|   		} else if (data == '$') {
#  418|   			debug_info("received prefix ($)");
#  419|-> 			buffer[0] = '$';
#  420|   			buffer_size = 1;
#  421|   			skip_prefix = 1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def18]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:438:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'buffer'
#  436|   		if (data == '$') {
#  437|   			debug_info("received prefix ($)");
#  438|-> 			buffer[0] = '$';
#  439|   			buffer_size = 1;
#  440|   		} else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:584:24: warning[-Wanalyzer-malloc-leak]: leak of 'pkt'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: note: in expansion of macro 'DEBUGSERVER_HEX_ENCODE_FIRST_BYTE'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_client_set_argv'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: note: in expansion of macro 'DEBUGSERVER_HEX_ENCODE_FIRST_BYTE'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_client_set_argv'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: note: in expansion of macro 'DEBUGSERVER_HEX_ENCODE_FIRST_BYTE'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_client_set_argv'
#  582|   {
#  583|   	if (!client || !argc)
#  584|-> 		return DEBUGSERVER_E_INVALID_ARG;
#  585|   
#  586|   	debugserver_error_t result = DEBUGSERVER_E_UNKNOWN_ERROR;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_client_set_argv'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:584:24: warning[-Wanalyzer-malloc-leak]: leak of 'pktp'
#  582|   {
#  583|   	if (!client || !argc)
#  584|-> 		return DEBUGSERVER_E_INVALID_ARG;
#  585|   
#  586|   	debugserver_error_t result = DEBUGSERVER_E_UNKNOWN_ERROR;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def21]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:606:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'pkt' where non-null expected
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
#  604|   	/* allocate packet and initialize it */
#  605|   	pkt = (char *) malloc(pkt_len + 1);
#  606|-> 	memset(pkt, 0, pkt_len + 1);
#  607|   
#  608|   	char *pktp = pkt;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def22]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'p'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:629:32: note: in expansion of macro 'DEBUGSERVER_HEX_ENCODE_FIRST_BYTE'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c: scope_hint: In function 'debugserver_client_set_argv'
#  627|   		char *q = (char*)argv[i];
#  628|   		while (*q) {
#  629|-> 			*p++ = DEBUGSERVER_HEX_ENCODE_FIRST_BYTE(*q);
#  630|   			*p++ = DEBUGSERVER_HEX_ENCODE_SECOND_BYTE(*q);
#  631|   			q++;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def23]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:637:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'm' where non-null expected
<built-in>: note: argument 2 of '__builtin_memcpy' must be non-null
#  635|   		pktp += strlen(prefix);
#  636|   
#  637|-> 		memcpy(pktp, m, arg_hexlen);
#  638|   		pktp += arg_hexlen;
#  639|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def24]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/debugserver.c:637:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'm'
#  635|   		pktp += strlen(prefix);
#  636|   
#  637|-> 		memcpy(pktp, m, arg_hexlen);
#  638|   		pktp += arg_hexlen;
#  639|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def25]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c: scope_hint: In function 'device_link_service_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/device_link_service.c:124:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#  122|   	/* create client object */
#  123|   	device_link_service_client_t client_loc = (device_link_service_client_t) malloc(sizeof(struct device_link_service_client_private));
#  124|-> 	client_loc->parent = plistclient;
#  125|   
#  126|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def26]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c: scope_hint: In function 'diagnostics_relay_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/diagnostics_relay.c:89:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   87|   	/* create client object */
#   88|   	diagnostics_relay_client_t client_loc = (diagnostics_relay_client_t) malloc(sizeof(struct diagnostics_relay_client_private));
#   89|-> 	client_loc->parent = plistclient;
#   90|   
#   91|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def27]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c: scope_hint: In function 'file_relay_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/file_relay.c:44:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   42|   	/* create client object */
#   43|   	file_relay_client_t client_loc = (file_relay_client_t) malloc(sizeof(struct file_relay_client_private));
#   44|-> 	client_loc->parent = plistclient;
#   45|   
#   46|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def28]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c: scope_hint: In function 'heartbeat_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/heartbeat.c:84:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   82|   
#   83|   	heartbeat_client_t client_loc = (heartbeat_client_t) malloc(sizeof(struct heartbeat_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   
#   86|   	*client = client_loc;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def29]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c: scope_hint: In function 'house_arrest_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/house_arrest.c:70:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   68|   
#   69|   	house_arrest_client_t client_loc = (house_arrest_client_t) malloc(sizeof(struct house_arrest_client_private));
#   70|-> 	client_loc->parent = plistclient;
#   71|   	client_loc->mode = HOUSE_ARREST_CLIENT_MODE_NORMAL;
#   72|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def30]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c: scope_hint: In function 'idevice_get_device_list_extended'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:332:35: warning[-Wanalyzer-null-dereference]: dereference of NULL 'newlist'
#  330|   	for (i = 0; dev_list[i].handle > 0; i++) {
#  331|   		newlist = realloc(*devices, sizeof(idevice_info_t) * (newcount+1));
#  332|-> 		newlist[newcount] = malloc(sizeof(struct idevice_info));
#  333|   		newlist[newcount]->udid = strdup(dev_list[i].udid);
#  334|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def31]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:333:41: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc(24)'
#  331|   		newlist = realloc(*devices, sizeof(idevice_info_t) * (newcount+1));
#  332|   		newlist[newcount] = malloc(sizeof(struct idevice_info));
#  333|-> 		newlist[newcount]->udid = strdup(dev_list[i].udid);
#  334|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {
#  335|   			newlist[newcount]->conn_type = CONNECTION_USBMUXD;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def32]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:355:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL '**_7.conn_data' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  353|   			}
#  354|   			newlist[newcount]->conn_data = malloc(addrlen);
#  355|-> 			memcpy(newlist[newcount]->conn_data, dev_list[i].conn_data, addrlen);
#  356|   		}
#  357|   		newcount++;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def33]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c: scope_hint: In function 'idevice_get_device_list'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:45: warning[-Wanalyzer-null-dereference]: dereference of NULL 'newlist'
#  401|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {
#  402|   			newlist = realloc(*devices, sizeof(char*) * (newcount+1));
#  403|-> 			newlist[newcount++] = strdup(dev_list[i].udid);
#  404|   			*devices = newlist;
#  405|   		}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def34]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:403:62: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
#  401|   		if (dev_list[i].conn_type == CONNECTION_TYPE_USB) {
#  402|   			newlist = realloc(*devices, sizeof(char*) * (newcount+1));
#  403|-> 			newlist[newcount++] = strdup(dev_list[i].udid);
#  404|   			*devices = newlist;
#  405|   		}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def35]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c: scope_hint: In function 'idevice_from_mux_device'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:473:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc(addrlen)' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  471|   		}
#  472|   		device->conn_data = malloc(addrlen);
#  473|-> 		memcpy(device->conn_data, muxdev->conn_data, addrlen);
#  474|   		break;
#  475|   	default:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def36]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c: scope_hint: In function 'idevice_connect'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:550:38: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_connection'
#  548|   		}
#  549|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  550|-> 		new_connection->type = CONNECTION_USBMUXD;
#  551|   		new_connection->data = (void*)(long)sfd;
#  552|   		new_connection->ssl_data = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def37]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:595:38: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_connection'
#  593|   
#  594|   		idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private));
#  595|-> 		new_connection->type = CONNECTION_NETWORK;
#  596|   		new_connection->data = (void*)(long)sfd;
#  597|   		new_connection->ssl_data = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def38]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c: scope_hint: In function 'idevice_connection_enable_ssl'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.c:1354:39: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'ssl_data_loc'
# 1352|   	} else {
# 1353|   		ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private));
# 1354|-> 		ssl_data_loc->session = ssl;
# 1355|   		ssl_data_loc->ctx = ssl_ctx;
# 1356|   		connection->ssl_data = ssl_data_loc;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def39]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c: scope_hint: In function 'instproxy_client_options_add'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:934:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'key' where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:26: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of 'strcmp' must be non-null
#  932|   	while (arg) {
#  933|   		char *key = strdup(arg);
#  934|-> 		if (!strcmp(key, "SkipUninstall")) {
#  935|   			int intval = va_arg(args, int);
#  936|   			plist_dict_set_item(client_options, key, plist_new_bool(intval));

Error: GCC_ANALYZER_WARNING (CWE-686): [#def40]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/installation_proxy.c:935:29: warning[-Wanalyzer-va-arg-type-mismatch]: 'va_arg' expected 'int' but received 'char (*)[4]' for variadic argument 2 of 'args'
#  933|   		char *key = strdup(arg);
#  934|   		if (!strcmp(key, "SkipUninstall")) {
#  935|-> 			int intval = va_arg(args, int);
#  936|   			plist_dict_set_item(client_options, key, plist_new_bool(intval));
#  937|   		} else if (!strcmp(key, "ApplicationSINF") || !strcmp(key, "iTunesMetadata") || !strcmp(key, "ReturnAttributes") || !strcmp(key, "BundleIDs")) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def41]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c: scope_hint: In function 'hkdf_md_expand'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c:209:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'output_block' where non-null expected
/usr/include/openssl/x509.h:29: included_from: Included from here.
/usr/include/openssl/ssl.h:32: included_from: Included from here.
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/idevice.h:30: included_from: Included from here.
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c:35: included_from: Included from here.
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c:194:32: note: in expansion of macro 'MD_ALGO_DIGEST_SIZE'
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  207|   		unsigned char* output_block = malloc(output_block_len);
#  208|   		if (okm_block_len > 0) {
#  209|-> 			memcpy(output_block, okm_block, okm_block_len);
#  210|   		}
#  211|   		memcpy(output_block + okm_block_len, info, info_len);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def42]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c:211:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'output_block' where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/lockdown-cu.c:194:32: note: in expansion of macro 'MD_ALGO_DIGEST_SIZE'
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  209|   			memcpy(output_block, okm_block, okm_block_len);
#  210|   		}
#  211|-> 		memcpy(output_block + okm_block_len, info, info_len);
#  212|   		output_block[okm_block_len + info_len] = (uint8_t)(i+1);
#  213|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def43]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c: scope_hint: In function 'misagent_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/misagent.c:101:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   99|   
#  100|   	misagent_client_t client_loc = (misagent_client_t) malloc(sizeof(struct misagent_client_private));
#  101|-> 	client_loc->parent = plistclient;
#  102|   	client_loc->last_error = 0;
#  103|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c: scope_hint: In function 'mobile_image_mounter_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobile_image_mounter.c:90:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   88|   
#   89|   	mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private));
#   90|-> 	client_loc->parent = plistclient;
#   91|   
#   92|   	mutex_init(&client_loc->mutex);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def45]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c: scope_hint: In function 'mobileactivation_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobileactivation.c:70:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   68|   	/* create client object */
#   69|   	mobileactivation_client_t client_loc = (mobileactivation_client_t) malloc(sizeof(struct mobileactivation_client_private));
#   70|-> 	client_loc->parent = plistclient;
#   71|   
#   72|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def46]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c: scope_hint: In function 'mobilebackup_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup.c:84:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   82|   
#   83|   	mobilebackup_client_t client_loc = (mobilebackup_client_t) malloc(sizeof(struct mobilebackup_client_private));
#   84|-> 	client_loc->parent = dlclient;
#   85|   
#   86|   	/* perform handshake */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def47]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c: scope_hint: In function 'mobilebackup2_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilebackup2.c:84:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   82|   
#   83|   	mobilebackup2_client_t client_loc = (mobilebackup2_client_t) malloc(sizeof(struct mobilebackup2_client_private));
#   84|-> 	client_loc->parent = dlclient;
#   85|   
#   86|   	/* perform handshake */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def48]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c: scope_hint: In function 'mobilesync_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:87:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   85|   
#   86|   	mobilesync_client_t client_loc = (mobilesync_client_t) malloc(sizeof(struct mobilesync_client_private));
#   87|-> 	client_loc->parent = dlclient;
#   88|   	client_loc->direction = MOBILESYNC_SYNC_DIR_DEVICE_TO_COMPUTER;
#   89|   	client_loc->data_class = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def49]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c: scope_hint: In function 'mobilesync_anchors_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:721:40: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'anchors'
#  719|   	mobilesync_anchors_t anchors = (mobilesync_anchors_t) malloc(sizeof(mobilesync_anchors));
#  720|   	if (device_anchor != NULL) {
#  721|-> 		anchors->device_anchor = strdup(device_anchor);
#  722|   	} else {
#  723|   		anchors->device_anchor = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def50]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:723:40: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'anchors'
#  721|   		anchors->device_anchor = strdup(device_anchor);
#  722|   	} else {
#  723|-> 		anchors->device_anchor = NULL;
#  724|   	}
#  725|   	if (computer_anchor != NULL) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def51]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c: scope_hint: In function 'mobilesync_actions_add'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:762:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'key' where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/mobilesync.c:29: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of 'strcmp' must be non-null
#  760|   	while (arg) {
#  761|   		char *key = strdup(arg);
#  762|-> 		if (!strcmp(key, "SyncDeviceLinkEntityNamesKey")) {
#  763|   			char **entity_names = va_arg(args, char**);
#  764|   			int entity_names_length = va_arg(args, int);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def52]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c: scope_hint: In function 'np_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/notification_proxy.c:101:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   99|   
#  100|   	np_client_t client_loc = (np_client_t) malloc(sizeof(struct np_client_private));
#  101|-> 	client_loc->parent = plistclient;
#  102|   
#  103|   	mutex_init(&client_loc->mutex);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def53]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c: scope_hint: In function 'preboard_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/preboard.c:84:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   82|   
#   83|   	preboard_client_t client_loc = (preboard_client_t) malloc(sizeof(struct preboard_client_private));
#   84|-> 	client_loc->parent = plclient;
#   85|   	client_loc->receive_status_thread = THREAD_T_NULL;
#   86|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def54]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c: scope_hint: In function 'property_list_service_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/property_list_service.c:74:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   72|   	/* create client object */
#   73|   	property_list_service_client_t client_loc = (property_list_service_client_t)malloc(sizeof(struct property_list_service_client_private));
#   74|-> 	client_loc->parent = parent;
#   75|   
#   76|   	/* all done, return success */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def55]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c: scope_hint: In function 'restored_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/restore.c:315:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#  313|   
#  314|   	restored_client_t client_loc = (restored_client_t) malloc(sizeof(struct restored_client_private));
#  315|-> 	client_loc->parent = plistclient;
#  316|   	client_loc->udid = NULL;
#  317|   	client_loc->label = NULL;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def56]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c: scope_hint: In function '_reverse_proxy_handle_plist_cmd'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:283:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'dict'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c: scope_hint: In function '_reverse_proxy_handle_plist_cmd'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c: scope_hint: In function '_reverse_proxy_handle_plist_cmd'
/usr/include/sys/types.h:176: included_from: Included from here.
/usr/include/stdlib.h:514: included_from: Included from here.
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:27: included_from: Included from here.
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c: scope_hint: In function '_reverse_proxy_handle_plist_cmd'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c: scope_hint: In function '_reverse_proxy_handle_plist_cmd'
#  281|   		return -1;
#  282|   	}
#  283|-> 	plist_t node = plist_dict_get_item(dict, "Command");
#  284|   	if (!node || (plist_get_node_type(node) != PLIST_STRING)) {
#  285|   		_reverse_proxy_log(client, "ERROR: No 'Command' in reply", err);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def57]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c: scope_hint: In function 'reverse_proxy_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:338:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#  336|   
#  337|   	reverse_proxy_client_t client_loc = (reverse_proxy_client_t) calloc(1, sizeof(struct reverse_proxy_client_private));
#  338|-> 	client_loc->parent = sclient;
#  339|   	client_loc->th_ctrl = THREAD_T_NULL;
#  340|   	*client = client_loc;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def58]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c: scope_hint: In function 'reverse_proxy_client_create_with_port'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/reverse_proxy.c:638:26: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  636|   	}
#  637|   
#  638|-> 	client_loc->type = RP_TYPE_CTRL;
#  639|   	*client = client_loc;
#  640|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def59]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c: scope_hint: In function 'sbservices_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/sbservices.c:91:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   89|   
#   90|   	sbservices_client_t client_loc = (sbservices_client_t) malloc(sizeof(struct sbservices_client_private));
#   91|-> 	client_loc->parent = plistclient;
#   92|   	mutex_init(&client_loc->mutex);
#   93|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def60]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c: scope_hint: In function 'screenshotr_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/screenshotr.c:81:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   79|   
#   80|   	screenshotr_client_t client_loc = (screenshotr_client_t) malloc(sizeof(struct screenshotr_client_private));
#   81|-> 	client_loc->parent = dlclient;
#   82|   
#   83|   	/* perform handshake */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def61]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c: scope_hint: In function 'service_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/service.c:72:32: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   70|   	/* create client object */
#   71|   	service_client_t client_loc = (service_client_t)malloc(sizeof(struct service_client_private));
#   72|-> 	client_loc->connection = connection;
#   73|   
#   74|   	/* enable SSL if requested */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def62]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c: scope_hint: In function 'syslog_relay_client_new'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/syslog_relay.c:89:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'client_loc'
#   87|   
#   88|   	syslog_relay_client_t client_loc = (syslog_relay_client_t) malloc(sizeof(struct syslog_relay_client_private));
#   89|-> 	client_loc->parent = parent;
#   90|   	client_loc->worker = THREAD_T_NULL;
#   91|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def63]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c: scope_hint: In function 'webinspector_receive_with_timeout'
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:195:32: warning[-Wanalyzer-malloc-leak]: leak of 'packet'
#  193|   			debug_info("Could not receive message, error %d", res);
#  194|   			plist_free(message);
#  195|-> 			return WEBINSPECTOR_E_MUX_ERROR;
#  196|   		}
#  197|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def64]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:223:41: warning[-Wanalyzer-malloc-leak]: leak of 'packet'
#  221|   		/* (re)allocate packet data */
#  222|   		if (!packet) {
#  223|-> 			packet = (char*)malloc(length * sizeof(char));
#  224|   		} else {
#  225|   			newpacket = (char*)realloc(packet, (packet_length + length) * sizeof(char));

Error: GCC_ANALYZER_WARNING (CWE-688): [#def65]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/src/webinspector.c:230:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'packet' where non-null expected
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  228|   
#  229|   		/* copy partial data into final packet data */
#  230|-> 		memcpy(packet + packet_length, buffer, length);
#  231|   
#  232|   		/* cleanup buffer */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def66]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c: scope_hint: In function ‘device_event_cb.part.0’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:1448:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/afcclient.c:32: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
# 1446|   			udid = strdup(event->udid);
# 1447|   		}
# 1448|-> 		if (strcmp(udid, event->udid) == 0) {
# 1449|   			connected = 1;
# 1450|   		}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def67]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c: scope_hint: In function ‘mobilebackup_build_path’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:238:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘filename’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null
#  236|   {
#  237|   	char* filename = (char*)malloc(strlen(name)+(extension == NULL ? 0: strlen(extension))+1);
#  238|-> 	strcpy(filename, name);
#  239|   	if (extension != NULL)
#  240|   		strcat(filename, extension);

Error: CPPCHECK_WARNING (CWE-457): [#def68]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:518: warning[uninitvar]: Uninitialized variable: file_hash
#  516|   		print_hash(data_hash, 20);
#  517|   		printf("\nfilehash: ");
#  518|-> 		print_hash(file_hash, 20);
#  519|   		printf("\n");
#  520|   		res = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def69]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c: scope_hint: In function ‘main’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup.c:662:30: warning[-Wanalyzer-malloc-leak]: leak of ‘udid’
#  660|   				return 2;
#  661|   			}
#  662|-> 			udid = strdup(optarg);
#  663|   			break;
#  664|   		case 'n':

Error: GCC_ANALYZER_WARNING (CWE-476): [#def70]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c: scope_hint: In function ‘get_uuid’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:342:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘uuid’
#  340|   
#  341|   	for (i = 0; i < 32; i++) {
#  342|-> 		uuid[i] = chars[rand() % 16];
#  343|   	}
#  344|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def71]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c: scope_hint: In function ‘mobilebackup_factory_info_plist_new’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:525:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fname’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#  523|   		data_size = 0;
#  524|   		char *fname = (char*)malloc(strlen("/iTunes_Control/iTunes/") + strlen(itunesfiles[i]) + 1);
#  525|-> 		strcpy(fname, "/iTunes_Control/iTunes/");
#  526|   		strcat(fname, itunesfiles[i]);
#  527|   		mobilebackup_afc_get_file_contents(afc, fname, &data_buf, &data_size);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def72]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c: scope_hint: In function ‘main’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebackup2.c:1555:30: warning[-Wanalyzer-malloc-leak]: leak of ‘udid’
# 1553|   				return 2;
# 1554|   			}
# 1555|-> 			udid = strdup(optarg);
# 1556|   			break;
# 1557|   		case 's':

Error: GCC_ANALYZER_WARNING (CWE-688): [#def73]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c: scope_hint: In function ‘device_event_cb.part.0’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:266:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicebtlogger.c:30: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
#  264|   				udid = strdup(event->udid);
#  265|   			}
#  266|-> 			if (strcmp(udid, event->udid) == 0) {
#  267|   				if (start_logging() != 0) {
#  268|   					fprintf(stderr, "Could not start logger for udid %s\n", udid);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def74]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c: scope_hint: In function ‘main’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicecrashreport.c:470:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ping’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null
#  468|   	/* read "ping" message which indicates the crash logs have been moved to a safe harbor */
#  469|   	char *ping = malloc(4);
#  470|-> 	memset(ping, '\0', 4);
#  471|   	int attempts = 0;
#  472|   	while ((strncmp(ping, "ping", 4) != 0) && (attempts < 10)) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def75]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c: scope_hint: In function ‘main’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:281:54: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘newlist’
#  279|   			else
#  280|   				newlist = realloc(environment, (environment_count + 1) * sizeof(char*));
#  281|-> 			newlist[environment_count++] = strdup(optarg);
#  282|   			environment = newlist;
#  283|   			break;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def76]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:468:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘app_argv’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedebug.c:464:9: note: in expansion of macro ‘log_debug’
#  466|   	int app_argc = (argc - i + 2);
#  467|   	char **app_argv = (char**)malloc(sizeof(char*) * app_argc);
#  468|-> 	app_argv[0] = path;
#  469|   	log_debug("app_argv[%d] = %s", 0, app_argv[0]);
#  470|   	app_argc = 1;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def77]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c: scope_hint: In function ‘device_event_cb.part.0’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:226:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicedevmodectl.c:30: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
#  224|   			udid = strdup(event->udid);
#  225|   		}
#  226|-> 		if (strcmp(udid, event->udid) == 0) {
#  227|   			device_connected = 1;
#  228|   		}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def78]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c: scope_hint: In function ‘main’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: warning[-Wanalyzer-null-argument]: use of NULL ‘image_path’ where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/include/libimobiledevice/libimobiledevice.h:35: included_from: Included from here.
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:43: included_from: Included from here.
/usr/include/sys/stat.h:205:12: note: argument 1 of ‘stat’ must be non-null
#  332|   			}
#  333|   		}
#  334|-> 		if (stat(image_path, &fst) != 0) {
#  335|   			fprintf(stderr, "ERROR: stat: %s: %s\n", image_path, strerror(errno));
#  336|   			goto leave;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def79]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:334:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘image_path’ where non-null expected
/usr/include/sys/stat.h:205:12: note: argument 1 of ‘stat’ must be non-null
#  332|   			}
#  333|   		}
#  334|-> 		if (stat(image_path, &fst) != 0) {
#  335|   			fprintf(stderr, "ERROR: stat: %s: %s\n", image_path, strerror(errno));
#  336|   			goto leave;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def80]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:339:51: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘image_sig_path’ where non-null expected
/usr/include/sys/stat.h:205:12: note: argument 1 of ‘stat’ must be non-null
#  337|   		}
#  338|   		image_size = fst.st_size;
#  339|-> 		if (product_version_major < 17 && stat(image_sig_path, &fst) != 0) {
#  340|   			fprintf(stderr, "ERROR: stat: %s: %s\n", image_sig_path, strerror(errno));
#  341|   			goto leave;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def81]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:28: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(image_sig_path, "rb")’
#  378|   				goto leave;
#  379|   			}
#  380|-> 			if (fstat(fileno(f), &fst) != 0) {
#  381|   				fprintf(stderr, "Error: fstat: %s\n", strerror(errno));
#  382|   				goto leave;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def82]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:380:28: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(image_sig_path, "rb")’
#  378|   				goto leave;
#  379|   			}
#  380|-> 			if (fstat(fileno(f), &fst) != 0) {
#  381|   				fprintf(stderr, "Error: fstat: %s\n", strerror(errno));
#  382|   				goto leave;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def83]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: warning[-Wanalyzer-null-argument]: use of NULL ‘image_path’ where non-null expected
/usr/include/sys/stat.h:205:12: note: argument 1 of ‘stat’ must be non-null
#  396|   			}
#  397|   		} else {
#  398|-> 			if (stat(image_path, &fst) != 0) {
#  399|   				fprintf(stderr, "Error: stat: '%s': %s\n", image_path, strerror(errno));
#  400|   				goto leave;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def84]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:398:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘image_path’ where non-null expected
/usr/include/sys/stat.h:205:12: note: argument 1 of ‘stat’ must be non-null
#  396|   			}
#  397|   		} else {
#  398|-> 			if (stat(image_path, &fst) != 0) {
#  399|   				fprintf(stderr, "Error: stat: '%s': %s\n", image_path, strerror(errno));
#  400|   				goto leave;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def85]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(string_build_path(image_path,  plist_get_string_ptr(plist_access_path(build_identity, 4, "Manifest", "PersonalizedDMG", "Info", "Path"), 0), 0), "rb")’
#  503|   			} else {
#  504|   				/* we need to re-connect in this case */
#  505|-> 				mobile_image_mounter_free(mim);
#  506|   				mim = NULL;
#  507|   				if (mobile_image_mounter_start_service(device, &mim, TOOL_NAME) != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def86]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/ideviceimagemounter.c:505:33: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(string_build_path(image_path,  plist_get_string_ptr(plist_access_path(build_identity, 4, "Manifest", "PersonalizedDMG", "Info", "Path"), 0), 0), "rb")’
#  503|   			} else {
#  504|   				/* we need to re-connect in this case */
#  505|-> 				mobile_image_mounter_free(mim);
#  506|   				mim = NULL;
#  507|   				if (mobile_image_mounter_start_service(device, &mim, TOOL_NAME) != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def87]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c: scope_hint: In function ‘main’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:186:49: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
#  184|   			if (argv[i] && (strlen(argv[i]) >= 2) && (strncmp(argv[i], "-", 1) != 0)) {
#  185|   				nspectmp = realloc(nspec, sizeof(char*) * (count+1));
#  186|-> 				nspectmp[count] = strdup(argv[i]);
#  187|   				nspec = nspectmp;
#  188|   				count = count+1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def88]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:189:34: warning[-Wanalyzer-malloc-leak]: leak of ‘nspec’
#  187|   				nspec = nspectmp;
#  188|   				count = count+1;
#  189|-> 				i++;
#  190|   			} else {
#  191|   				i--;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def89]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:197:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
#  195|   
#  196|   		nspectmp = realloc(nspec, sizeof(char*) * (count+1));
#  197|-> 		nspectmp[count] = NULL;
#  198|   		nspec = nspectmp;
#  199|   	}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def90]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:236:52: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
#  234|   				case CMD_POST:
#  235|   					i = 0;
#  236|-> 					while(nspec[i] != NULL && i < (count+1)) {
#  237|   						printf("< posting \"%s\"\n", nspec[i]);
#  238|   						np_post_notification(gnp, nspec[i]);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def91]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicenotificationproxy.c:245:52: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nspectmp’
#  243|   				default:
#  244|   					i = 0;
#  245|-> 					while(nspec[i] != NULL && i < (count+1)) {
#  246|   						printf("! observing \"%s\"\n", nspec[i]);
#  247|   						np_observe_notification(gnp, nspec[i]);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def92]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c: scope_hint: In function ‘get_image_filename’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:69:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘basename’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strcpy’ must be non-null
#   67|   	if (*filename) {
#   68|   		basename = (char*)malloc(strlen(*filename) + 1);
#   69|-> 		strcpy(basename, *filename);
#   70|   		free(*filename);
#   71|   		*filename = NULL;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def93]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:75:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘basename’ where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:33: included_from: Included from here.
/usr/include/time.h:99:15: note: argument 1 of ‘strftime’ must be non-null
#   73|   		time_t now = time(NULL);
#   74|   		basename = (char*)malloc(32);
#   75|-> 		strftime(basename, 31, "screenshot-%Y-%m-%d-%H-%M-%S", gmtime(&now));
#   76|   	}
#   77|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def94]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:80:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘unique_filename’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_sprintf’ must be non-null
#   78|   	// Ensure the filename is unique on disk.
#   79|   	char *unique_filename = (char*)malloc(strlen(basename) + strlen(fileext) + 7);
#   80|-> 	sprintf(unique_filename, "%s%s", basename, fileext);
#   81|   	int i;
#   82|   	for (i = 2; i < (1 << 16); i++) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def95]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicescreenshot.c:92:9: warning[-Wanalyzer-malloc-leak]: leak of ‘unique_filename’
#   90|   		free(unique_filename);
#   91|   	}
#   92|-> 	free(basename);
#   93|   }
#   94|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def96]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c: scope_hint: In function ‘main’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesetlocation.c:178:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘buf’
#  176|   		latlen = strlen(argv[0]);
#  177|   		l = htobe32(latlen);
#  178|-> 		memcpy(buf, &l, 4);
#  179|   		memcpy(buf+4, argv[0], latlen);
#  180|   		uint32_t longlen = strlen(argv[1]);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def97]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c: scope_hint: In function ‘add_filter’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:87:47: warning[-Wanalyzer-malloc-leak]: leak of ‘procn’
#   85|   		if ((*p == '|') || (*p == '\0')) {
#   86|   			if (p-start > 0) {
#   87|-> 				char* procn = malloc(p-start+1);
#   88|   				if (!procn) {
#   89|   					fprintf(stderr, "ERROR: malloc() failed\n");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def98]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:120:1: warning[-Wanalyzer-malloc-leak]: leak of ‘procn’
#  118|   		p++;
#  119|   	}
#  120|-> }
#  121|   
#  122|   static int find_char(char c, char** p, const char* end)

Error: GCC_ANALYZER_WARNING (CWE-688): [#def99]
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c: scope_hint: In function ‘device_event_cb.part.0’
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:442:29: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘udid’ where non-null expected
libimobiledevice-1.3.0_20240916gited9703d-build/libimobiledevice-ed9703db1ee6d54e3801b618cee9524563d709e1/tools/idevicesyslog.c:30: included_from: Included from here.
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
#  440|   				udid = strdup(event->udid);
#  441|   			}
#  442|-> 			if (strcmp(udid, event->udid) == 0) {
#  443|   				if (start_logging() != 0) {
#  444|   					fprintf(stderr, "Could not start logger for udid %s\n", udid);

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-250.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibimobiledevice-1.3.0^20240916gited9703d-1.fc42
store-results-to/tmp/tmpkffq2liu/libimobiledevice-1.3.0^20240916gited9703d-1.fc42.tar.xz
time-created2024-11-13 01:25:27
time-finished2024-11-13 01:27:34
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpkffq2liu/libimobiledevice-1.3.0^20240916gited9703d-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpkffq2liu/libimobiledevice-1.3.0^20240916gited9703d-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9